package master.photo.domain.security

import java.util.Date;

import master.photo.domain.Profile;


class AppUser {
	
	String username;
	String passwd;
	String email;
	boolean enabled;
	
	boolean emailShow = true;
	
	Date dateCreated;
	Date lastUpdated;
	
	UserRole userRole;
	Profile profile;
	
	static hasMany = [friends: AppUser];
	
	static mapping = {
		profile lazy: false
		userRole lazy: false
	}
	
	static constraints = {
		username(blank: false, unique: true)
		passwd(
		blank: false
		//validator: {passwd, user -> return passwd == user.username}
		)
		email(email: true, nullable: true)
		enabled()
		profile(nullable: true)
		userRole(nullable: true)
	}
}
